package ee.ut.maxorato_macobo.oop.mud.items;

import java.util.Scanner;

import ee.ut.maxorato_macobo.oop.mud.game.DataParser;

public class ItemTemplate {	
	private String itemName;
	private String itemLongName;
	private String itemDescription;
	private String uniqueName;
	private int weight;
	
	public ItemTemplate(String newUniqueName, String newItemName, String newItemLongName, String newItemDescription) {
		uniqueName = newUniqueName;
		
		itemName = newItemName;
		itemLongName = newItemLongName;
		itemDescription = newItemDescription;
		
		weight = 1;
	}
	
	public Class<? extends ItemBase> getItemClass() {
		return ItemBase.class;
	}
	
	public String getItemType() {
		return "base";
	}
	
	public ItemBase createInstance(ContainsItems itemLocation) {
		Class<? extends ItemBase> itemClass = this.getItemClass();
		
		try {
			return itemClass.getDeclaredConstructor(ItemTemplate.class, ContainsItems.class).newInstance(this, itemLocation);
		}
		catch(Exception ex) {
			ex.printStackTrace();
			return null;
		}
	}
	
	public void parseExtraSection(Scanner parser) {
		DataParser.parseDummy(parser);
	}
	
	public String getUniqueName() {
		return uniqueName;
	}
	
	public void setName(String newItemName) {
		itemName = newItemName;
	}
	
	public String getName() {
		return itemName;
	}
	
	public void setLongName(String newItemLongName) {
		itemLongName = newItemLongName;
	}
	
	public String getLongName() {
		return itemLongName;
	}
	
	public void setDescription(String newItemDescription) {
		itemDescription = newItemDescription;
	}
	
	public String getDescription() {
		return itemDescription;
	}
	
	public void setWeight(int newWeight) {
		weight = newWeight;
	}
	
	public int getWeight() {
		return weight;
	}
}
